package com.hk.huakangcompany.mapper;

import com.hk.huakangcompany.model.WxRolePermissionRelation;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

/**
 * @Author: aerfazhe
 * @Date: 2021/7/26 10:42
 * @Statement: 角色权限Mapper层接口
 */
public interface WxRolePermissionRelationMapper extends BaseMapper<WxRolePermissionRelation> {

    @Override
    List<WxRolePermissionRelation> findAll(WxRolePermissionRelation wxRolePermissionRelation);

    @Override
    int count(WxRolePermissionRelation wxRolePermissionRelation);

    @Override
    WxRolePermissionRelation findById(Integer id);

    @Select("select * from wx_role_permission_relation where role_id = #{id} ")
    List<WxRolePermissionRelation> findByRoleId(Integer id);

    Set<Integer> findByRoleIds(@Param("roleIds") List<Integer> roleIds);

    @Insert("insert into wx_role_permission_relation values (null,#{roleId},#{permissionId})")
    @Override
    int save(WxRolePermissionRelation wxRolePermissionRelation);

    @Override
    int update(WxRolePermissionRelation wxRolePermissionRelation);

    @Override
    int delete(Integer id);

    @Delete("delete from wx_role_permission_relation where role_id = #{roleId} ")
    int deleteByRoleId(Integer roleId);

}
